import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-com-step-e',
  templateUrl: './com-step-e.component.html',
  styleUrls: ['./com-step-e.component.scss']
})
export class ComStepEComponent implements OnInit {


  get tableHeader() {
    return ['组合1', '组合2', '组合3', '组合4']
  }
  data = [
    {
      zb: 'A工人安全B公众接受度',
      A: true,
      B: false,
      v1: false,
      v3: true,
      v5: false,
      v7: false,
      v9: false,
      getParams: () => {
        let k = this.data[0].A ? 'A' : 'B'
        let k1 = () => {
          let { v1, v3, v5, v7, v9 } = this.data[0];
          if (v1) return 1
          if (v3) return 3
          if (v5) return 5
          if (v7) return 7
          if (v9) return 9

        }
        return {
          k,
          k1: k1()
        }
      }
    }, {
      zb: 'A工人安全B社区影响',
      A: true,
      B: false,
      v1: false,
      v3: false,
      v5: true,
      v7: false,
      v9: false,
      getParams: () => {
        let l = this.data[1].A ? 'A' : 'B'
        let l1 = () => {
          let { v1, v3, v5, v7, v9 } = this.data[1];
          if (v1) return 1
          if (v3) return 3
          if (v5) return 5
          if (v7) return 7
          if (v9) return 9

        }
        return {
          l,
          l1: l1()
        }
      }
    }, {
      zb: 'A工人安全B社区影响',
      A: true,
      B: false,
      v1: false,
      v3: true,
      v5: false,
      v7: false,
      v9: false,
      getParams: () => {
        let m = this.data[2].A ? 'A' : 'B'
        let m1 = () => {
          let { v1, v3, v5, v7, v9 } = this.data[2];
          if (v1) return 1
          if (v3) return 3
          if (v5) return 5
          if (v7) return 7
          if (v9) return 9

        }
        return {
          m,
          m1: m1()
        }
      }
    },

  ]

  radioChange(item, type) {
    if (type == 'a') {
      item.B = false

    }
    if (type == 'b') {
      item.A = false
    }
  }

  ngOnInit() {
  }

  radioABChange(item, type) {
    if (type == 'a') {
      item.B = false

    }
    if (type == 'b') {
      item.A = false
    }
  }

  radioValueChange(item, key) {
    ['v1',
      'v3',
      'v5',
      'v7',
      'v9'].forEach(i => {
        if (i != key) {
          item[i] = false
        }
      })
  }

}

